import PropsType from "prop-types";
import DateRangePickCus from "../../DateRangePickCus/DateRangePickCus";

const MyDateRangePickCus = ({field, setFieldValue, label, placeholder, minDate, maxDate}) => {
  return (
    <DateRangePickCus
      {...field}
      label={label}
      placeholder={placeholder}
      minDate={minDate}
      maxDate={maxDate}
      value={field.value}
      onChange={(value) => {
        setFieldValue(field.name, value)
      }}
    />
  )
}

MyDateRangePickCus.propTypes = {
  placeholder: PropsType.string,
  label: PropsType.string,
  setFieldValue: PropsType.func.isRequired,
  minDate: PropsType.any,
  maxDate: PropsType.any
}

DateRangePickCus.defaultProps = {
  placeholder: '时间范围',
  label: '时间范围',
  minDate: new Date(new Date().getTime() - 10 * 365 * 24 * 60 * 60 * 1000),
  maxDate: new Date()
}

export default MyDateRangePickCus